package com.lmk.qs.dataSourse;

import com.alibaba.druid.pool.DruidDataSource;
import com.alibaba.druid.pool.DruidDataSourceFactory;
import com.lmk.qs.utils.DruidUtil;
import com.lmk.qs.utils.JDBCUtil;

import javax.sql.DataSource;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Properties;

/**
 * 配置druid数据库连接池
 */
public class Druid {
    public static void main(String[] args) throws Exception {
        Connection con=null;
        Statement sta=null;
        ResultSet rs=null;
        con=DruidUtil.getConnection();
        String sql="select * from emp";
        sta=con.createStatement();
        rs= sta.executeQuery(sql);
        while (rs.next()){
            System.out.print("id" + "\t" + rs.getString(1));
            System.out.print("\t" +"name" + "\t" + rs.getString(2));
            System.out.print("\t" +"gender" + "\t" + rs.getString(3));
            System.out.print("\t" +"salary" + "\t" + rs.getString(4));
            System.out.print("\t" +"join_date" + "\t" + rs.getString(5));
            System.out.println("\t" +"dept_id" + "\t" + rs.getString(6));


        }
        DruidUtil.close(rs);
        DruidUtil.close(sta);
        DruidUtil.close(con);
    }
}
